/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * <p>Project: jse2306 - Date2</p>
 * <p>Powered by webrx On 2023-10-11 09:41:27</p>
 * <p>description: </p>
 *
 * @author 李四 [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Date2 {
    public static void main(String[] args) throws ParseException {
        //学习SimpleDateFormat
        //java.text.SimpleDateFormat格式化日期的工具类
        //java.util.Date 日期工具类

        //Locale.setDefault(Locale.US);
        //Locale.setDefault(Locale.CHINA);
        //Locale.setDefault(Locale.JAPAN);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss EEEE MMMMM a D");
        String info = sdf.format(new Date());
        System.out.println(info);

        //
        String birth = "2024-1-1";
        var sd2 = new SimpleDateFormat("yyyy-MM-dd");
        Date db = sd2.parse(birth);//将字符串转换为Date对象

        //输出格式化结果字符串
        System.out.println(sdf.format(db));


    }
}
